#ifndef _RETRANSMIT_HPP
#define _RETRANSMIT_HPP 1

#include "../Parameters.hpp"
#include "MacArrayMessage.hpp"

namespace BFT
{
	namespace messages
	{
		class Retransmit : public MacArrayMessage
		{
			public:
			
			Retransmit(uint32_t _clientId, uint32_t _seqNo, uint32_t _sender);
			
			Retransmit(boost::shared_ptr<char> _bytes, int _bytes_size);
			
			uint32_t getClient(); //inlined
			
			uint32_t getSequenceNumber(); //inlined
			
			uint32_t getSendingReplica(); //inlined
			
			// static uint16_t tag(); useless?
			
			bool equals(boost::shared_ptr<BFT::messages::Retransmit> _ret);
			
			bool matches(boost::shared_ptr<BFT::messages::VerifiedMessageBase> _vmb);
			
			void printInfo();
			
			protected:
			
			uint32_t seqNo;
			uint32_t client;
			
			private:
			
			static uint32_t computeSize();
		};
		
		inline uint32_t Retransmit::getClient() {return client;}
		inline uint32_t Retransmit::getSequenceNumber() {return seqNo;}
		inline uint32_t Retransmit::getSendingReplica() {return getSender();}
		inline uint32_t Retransmit::computeSize() {return SEQUENCE_NUMBER_SIZE + CLIENT_ID_SIZE;}
	}
}

#endif
